﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;

/// <summary>
/// 行走状态
/// </summary>
[CreateAssetMenu(menuName = "MyScript/State/ControllableState/Chracter1State/WalkState")]
public class ControllableWalkState : ControllableObjectState, IMovableState
{
    /// <summary>
    /// 影响移动速度的因素
    /// </summary>
    [SerializeField] private float m_moveSpeedFactor;

    private Creature m_creature;

    public float GetMoveSpeed(GameObject gameObject)
    {
        if (null == m_creature)
        {
            m_creature = gameObject.GetComponent<Creature>();
            if (m_creature == null)
            {
                return -1;
            }
        }

        return m_creature.MoveSpeed * m_moveSpeedFactor;
    }
}
